package com.lingyun.mqttserver.controller;

import com.lingyun.mqttserver.dao.pojo.Project;
import com.lingyun.mqttserver.service.ManageDataService;
import com.lingyun.mqttserver.vo.ProjectAddVo;
import com.lingyun.mqttserver.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

// 项目管理
@RestController
@RequestMapping("project")
public class ProjectController {

    @Autowired
    private ManageDataService manageDataService;

    @GetMapping("projectList")
    public Result projectList(){
        return manageDataService.projectList();
    }

    @GetMapping("projectListName")
    public Result projectListName(){
        return manageDataService.projectListName();
    }

    @PostMapping("projectAdd")
    public Result projectAdd(@RequestBody Project project){
        return manageDataService.projectAdd(project);
    }

    @PostMapping("projectUpdate")
    public Result projectUpdate(@RequestBody Project project){
        return manageDataService.projectUpdate(project);
    }

    @DeleteMapping("projectDelete")
    public Result projectDelete(@RequestParam Integer id){
        return manageDataService.projectDelete(id);
    }
}
